Image reading device, method for the same to detect a foreign body on a scanner glass platen, and recording medium

ABSTRACT

An image reading device includes: a scanner glass; photo-sensors arranged at intervals in a main scanning direction to read a document conveyed in a sub-scanning direction; an adjuster that adjusts the size of an overlapping area between a first and second image obtained by neighboring photo-sensors, the overlapping area constituting a first area of the first image and a second area of the second image; a superimposing portion that shifts either one of images of the first and second area to the other one; a judgment portion that judges whether the images having different focal depths exist based on the degree of matching between the first and second area; and a detector that detects a foreign body on the scanner glass platen by detecting a continuous image stretching in a document conveying direction in both of the images having different focal depths, if the images having different focal depths exist.

This application claims priority under 35 U.S.C. § 119 to JapanesePatent Application No. 2016-068831 filed on Mar. 30, 2016, the entiredisclosure of which is incorporated herein by reference.

BACKGROUND OF THE INVENTION

Field of the Invention

The present invention relates to an image reading device to be used inan image forming apparatus, for example, the image reading device beingconfigured to read an image on a sheet of document conveyed on a scannerglass platen in a sub-scanning direction, a method for the image readingdevice to detect a foreign body on the scanner glass platen, and arecording medium.

Description of the Related Art

The following description sets forth the inventor's knowledge of relatedart and problems therein and should not be construed as an admission ofknowledge in the prior art.

Image forming apparatuses are commonly provided with an image readingdevice with an on-board automatic document feeder. Since a sheet ofdocument is conveyed in a sub-scanning direction on a scanner glassplaten of such an image forming apparatus, a scanned image may contain alinear noise area, which stretches in a document conveying direction,due to a foreign body such as lint, dust, or dirt on the scanner glassplaten.

To remove such a noise area, the following methods have been alreadyproposed and known: a method of detecting a foreign body on a scannerglass platen and a method of detecting a noise area due to a foreignbody from a scanned image.

For example, Japanese Unexamined Patent Application Publication No.2000-287039 discloses a technique of identifying the position of aforeign body and replacing the affected pixels with white pixels.

For another example, Japanese Unexamined Patent Application PublicationNo. 2002-185767 discloses a technique of counting up all lines in asub-scanning direction and detecting noise when the level is equal to orgreater than its threshold value.

According to the publications, these techniques are provided with onephoto-sensor, such as a CCD image sensor, disposed in a main scanningdirection to read a document image. This configuration with onephoto-sensor allows identifying the source of noise as either a sheet ofdocument or a foreign body such as lint on the scanner glass platen,using one single scanned image. These techniques, therefore, do notcover detecting a foreign body with a high degree of accuracy; in otherwords, these are hardly capable of correctly identifying the source of aliner noise area stretching in a direction, in which a sheet of documentis conveyed, as either a sheet of document or a foreign body on thescanner glass platen.

To achieve accurate detection, Japanese Unexamined Patent ApplicationPublication No. 2002-271631 discloses a technique of scanning images bya 4-CCD image sensor with a gray (Gr), red (R), green (G), and blue (B)channels and comparing these images using the interval between the linesfor these channels, which are arranged in a document conveyingdirection.

However, the technique disclosed in Japanese Unexamined PatentApplication Publication No. 2002-271631 is based on the assumption thatthe size of a foreign body is equal to or smaller than the intervalbetween the lines of the CCD image sensor; that is, it is hardly capableof detecting a foreign body whose size is larger than the intervalbetween the lines. Furthermore, the technique is not capable ofdetecting a foreign body hiding all the Gr and RGB channels.

As described above, a foreign body such as lint, dust, or dirt on ascanner glass platen causes a linear noise area in a scanned image; theimaging performance of an image reading device with an on-boardautomatic document feeder is thus affected negatively. Such an imagereading device does not cover detecting a foreign body with a highdegree of accuracy; in other words, it is hardly capable of correctlyidentifying the source of noise as either a sheet of document or aforeign body on the scanner glass platen.

SUMMARY OF THE INVENTION

The description herein of advantages and disadvantages of variousfeatures, embodiments, methods, and apparatus disclosed in otherpublications is in no way intended to limit the present invention.Indeed, certain features of the invention may be capable of overcomingcertain disadvantages, while still retaining some or all of thefeatures, embodiments, methods, and apparatus disclosed therein.

A first aspect of the present invention relates to an image readingdevice including:

-   -   a scanner glass; and    -   a plurality of CCD photo-sensors being arranged at intervals in        a main scanning direction, the CCD photo-sensors being        configured to read an image on a sheet of document conveyed in a        sub-scanning direction on a document conveying surface, the        document conveying surface being disposed above the scanner        glass,        wherein the CCD photo-sensors are arranged in such a manner as        to allow two or more neighboring ones of the CCD photo-sensors        to obtain a first image and a second image by scanning the same        area of the surface of the scanner glass and the document        conveying surface, the image reading device further comprising:    -   a size adjuster being configured to adjust the size, in a main        scanning direction and a sub-scanning direction, of an        overlapping area between the first and second image obtained by        the neighboring CCD photo-sensors, the overlapping area        constituting a first area of the first image and a second area        of the second image;    -   a superimposing portion being configured to superimpose either        one of an image of the first area and an image of the second        area on the other one by shifting at least one of the image of        the first area and the image of the second area to the other        one, the first and second area having the size adjusted by the        size adjuster;    -   a degree of matching calculator being configured to calculate        the degree of matching between the image of the first area and        the image of the second area while the superimposing portion is        shifting at least one of the image of the first area and the        image of the second area to the other one;    -   a judgment portion being configured to judge whether or not the        images having different focal depths exist based on the degree        of matching calculated by the degree of matching calculator; and    -   a foreign body detector being configured to detect a foreign        body on the surface of the scanner glass by detecting a        continuous image stretching in a document conveying direction in        both of the images having different focal depths, if the        judgment portion judges that the images having different focal        depths exist.

A second aspect of the present invention relates to a method for animage reading device to detect a foreign body on the surface of ascanner glass, the image reading device including:

-   -   the scanner glass; and    -   a plurality of CCD photo-sensors being arranged at intervals in        a main scanning direction, the CCD photo-sensors being        configured to read an image on a sheet of document conveyed in a        sub-scanning direction on a document conveying surface, the        document conveying surface being disposed above the scanner        glass,    -   wherein the CCD photo-sensors are arranged in such a manner as        to allow two or more neighboring ones of the CCD photo-sensors        to obtain a first image and a second image by scanning the same        area of the surface of the scanner glass and the document        conveying surface,    -   the method comprising the following steps of the image reading        device:    -   adjusting the size, in a main scanning direction and a        sub-scanning direction, of an overlapping area between the first        and second image obtained by the neighboring CCD photo-sensors,        the overlapping area constituting a first area of the first        image and a second area of the second image;    -   superimposing either one of an image of the first area and an        image of the second area on the other one by shifting at least        one of the image of the first area and the image of the second        area to the other one, the first and second area having the size        being adjusted;    -   calculating the degree of matching between the image of the        first area and the image of the second area while at least one        of the image of the first area and the image of the second area        is being shifted to the other one;    -   judging whether or not the images having different focal depths        exist with reference to the degree of matching being calculated;        and    -   detecting a foreign body on the surface of the scanner glass by        detecting a continuous image stretching in a document conveying        direction in both of the images having different focal depths,        if it is judged that the images having different focal depths        exist.

A third aspect of the present invention relates to a non-transitorycomputer-readable recording medium storing a program to be run by animage reading device being configured to detect a foreign body on thesurface of a scanner glass, the image reading device including:

-   -   the scanner glass; and    -   a plurality of CCD photo-sensors being arranged at intervals in        a main scanning direction, the CCD photo-sensors being        configured to read an image on a sheet of document conveyed in a        sub-scanning direction on a document conveying surface, the        document conveying surface being disposed above the scanner        glass,        wherein the CCD photo-sensors are arranged in such a manner as        to allow two or more neighboring ones of the CCD photo-sensors        to obtain a first image and a second image by scanning the same        area of the surface of the scanner glass and the document        conveying surface, the program making a computer of the image        reading device execute:    -   adjusting the size, in a main scanning direction and a        sub-scanning direction, of an overlapping area between the first        and second image obtained by the neighboring CCD photo-sensors,        the overlapping area constituting a first area of the first        image and a second area of the second image;    -   superimposing either one of an image of the first area and an        image of the second area on the other one by shifting at least        one of the image of the first area and the image of the second        area to the other one, the first and second area having the size        being adjusted;    -   calculating the degree of matching between the image of the        first area and the image of the second area while at least one        of the image of the first area and the image of the second area        is being shifted to the other one;    -   judging whether or not the images having different focal depths        exist with reference to the degree of matching being calculated;        and    -   detecting a foreign body on the surface of the scanner glass by        detecting a continuous image stretching in a document conveying        direction in both of the images having different focal depths,        if it is judged that the images having different focal depths        exist.

The above and/or other aspects, features and/or advantages of variousembodiments will be further appreciated in view of the followingdescription in conjunction with the accompanying figures. Variousembodiments can include and/or exclude different aspects, featuresand/or advantages where applicable. In addition, various embodiments cancombine one or more aspect or feature of other embodiments whereapplicable. The descriptions of aspects, features and/or advantages ofparticular embodiments should not be construed as limiting otherembodiments or the claims.

BRIEF DESCRIPTION OF THE DRAWINGS

The preferred embodiments of the present invention are shown by way ofexample, and not limitation, in the accompanying drawings, in which:

FIG. 1 illustrates a comprehensive configuration of an image formingapparatus provided with an image reading device according to oneembodiment of the present invention;

FIG. 2 schematically illustrates a configuration of a document scanner20 in such a manner as to be seen from a sub-scanning direction (adirection in which a sheet of document is conveyed);

FIG. 3 is a block diagram illustrating an electrical configuration ofthe document scanner 20;

FIG. 4 is a main flowchart representing the entire operation to beperformed by the document scanner 20;

FIG. 5 is a flowchart representing the operation of calculating thedegree of matching between images, which is Step S2 in the FIG. 4flowchart;

FIGS. 6A and 6B are explanatory views on steps in the FIG. 5 flowchart;

FIGS. 7A to 7E are explanatory views on Steps S24 to S26 in the FIG. 5flowchart when there is a foreign body such as lint or dust on thescanner glass platen;

FIG. 8 is a flowchart representing the operation of identifying thesource of noise, which is Step S3 in the FIG. 4 flowchart;

FIGS. 9A to 9D are explanatory views on steps in the FIG. 8 flowchart;

FIG. 10 is a flowchart representing the operation of replacing a noisearea with a clean area, which is Step S4 in the FIG. 4 flowchart;

FIGS. 11A and 11B are explanatory views on steps in the FIG. 10flowchart;

FIG. 12 is a flowchart representing the operation of creating acomposite image, which is Step S5 in the FIG. 4 flowchart; and

FIGS. 13A and 13B illustrate an explanatory views on the operation ofimage composition.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

In the following paragraphs, some preferred embodiments of the inventionwill be described by way of example and not limitation. It should beunderstood based on this disclosure that various other modifications canbe made by those in the art based on these illustrated embodiments.

Hereinafter, some embodiments of the present invention will be describedwith reference to the accompanying drawings.

FIG. 1 illustrates a comprehensive configuration of an image formingapparatus provided with an image reading device according to oneembodiment of the present invention. As illustrated in this figure, theimage forming apparatus is provided with an automatic document feeder10, a document scanner 20 corresponding to an image reading device, animaging portion 30, an automatic duplexer 40, a sheet feeder 50, a papercabinet 60, an operation panel 70, a facsimile unit 90, a communicationinterface (I/F) unit 91, a controller 100, and a memory 120.

The automatic document feeder 10 automatically conveys multiple sheetsof document put on a sheet feeder tray, one after another, to a documentscanning position predetermined on a platen that is the surface of ascanner glass of the document scanner 20. The automatic document feeder10 is a publicly known device that is configured to push out a sheet ofdocument onto a document sheet output tray every time the documentscanner 20 finishes reading it. The automatic document feeder 10 isprovided with a document placement sensor 11, which is comprised of apublicly known tactile switch. The document placement sensor 11 judgeswhether or not a document is properly placed and transmit the result ofjudgment to the controller 100 by signal.

The document scanner 20 scans an image on a sheet of document at thedocument scanning position in a suitable manner for the size of thesheet of document. Subsequently, the document scanner 20 receives lightemitted by a luminous source toward the sheet of document then reflectedtherefrom, as incident light, converts the incident light to electricalsignals, then transfers them to the controller 100 as image data. Thedocument scanner 20 is provided with a device lift sensor 21, which iscomprised of a publicly known magnetic sensor. The device lift sensor 21judges whether or not the automatic document feeder 10 is lifted andtransmits the result of judgment to the controller 100 by signal.

The operation panel 70 is a publicly-known user interface, which isprovided with a touchscreen entry portion 71 and a key entry portion 72.The operation panel 70 is further provided with a secondary power switch80. The secondary power switch 80 is a switch that allows the user tomanually switch the operation mode to sleep mode that is power-savingmode.

The controller 100 performs various data processing tasks such asshading correction on the scanned image received. In synchronizationwith a sheet of paper being supplied, the controller 100 outputs signalto drive a laser diode along every main scanning line. Furthermore, inthis embodiment, the controller 100 detects a foreign body on a scannerglass platen 201 using images obtained by CCD image sensors and performsimage correction. This will be later described in details.

The facsimile unit 90 is connected to a public telephone network; it isan interface for transmission and reception of image data.

The communication I/F unit 91 is an interface for connecting to externalnetworks to which personal computers and other apparatuses belong. Theexternal networks include LAN and USB.

The memory 120 stores image data received from the controller 100 andother data. The memory 120 is comprised of a hard disk drive (HDD), forexample.

The imaging portion 30 forms an image by an electro-photographic methodthat is widely known. The imaging portion 30 is provided withphoto-conductor drums 31 a, 31 b, 31 c, and 31 d, photo-conductorexposure units 32 a, 32 b, 32 c, and 32 d, a transfer belt 33, a frontcover sensor 34, and, although it is not shown in this figure, a frontcover for protecting all the preceding portions. The imaging portion 30forms a four-color image for yellow, magenta, cyan, and black printing.In accordance with signals received from the controller 100, thephoto-conductor exposure units 32 generate laser light and expose thesurfaces of the photo-conductor drums 31 with the laser light. The frontcover sensor 34 is comprised of a publicly known tactile switch. Thefront cover sensor 34 judges whether or not the front cover is open andtransmits the result of judgment to the controller 100 by signal. Thetransfer belt 33 receives CMYK toner images from the surfaces of thephoto-conductor drums 31 one after another and transfers them onto asheet of paper that is delivered from the sheet feeder 50.

The sheet feeder 50 is provided with paper cassettes 51 and 53 forloading sheets of paper and paper pickup rollers 52 and 54 for pickingup the sheets of paper therefrom one after another. The sheet feeder 50feeds the sheets of paper into the imaging portion 30.

Similarly, the paper cabinet 60 is provided with paper cassettes 61 and63 for loading sheets of paper and paper pickup rollers 62 and 64 forpicking up the sheets of paper therefrom one after another. The papercabinet 60 feeds the sheets of paper into the imaging portion 30 throughthe sheet feeder 50.

The automatic duplexer 40 switches the direction of conveyance to itsopposite to turn a sheet of paper with printing on one side upside down.The automatic duplexer 40 enables duplex printing by feeding a sheet ofpaper twice.

FIG. 2 schematically illustrates a configuration of the document scanner20 illustrated in FIG. 1 in such a manner as to be seen from asub-scanning direction (a direction in which a sheet of document isconveyed).

In this figure, the code 200 indicates a scanner glass (as known asplaten). It is necessary for the automatic document feeder 10 to conveya sheet of document while keeping it very close to the scanner glassplaten 201 that is the top surface of the scanner glass 200. Therefore,the automatic document feeder 10 is further provided with a documentconveying surface 202 above the scanner glass platen 201, allowing asheet of document to pass through a small clearance between the scannerglass platen 201 and the document conveying surface 202. The smallclearance between the scanner glass platen 201 and the documentconveying surface 202 is kept by a sheet-like space keeper, for example,disposed at a position required.

Provided below the scanner glass 200 are a plurality of CCD imagesensors 1 to N that are CCD photo-sensors for optically receiving imagesreduced by lenses not shown in this figure. The CCD image sensors 1 to N(also to be referred to as “CCDs” for simplicity) are arranged atintervals in such a manner as to obtain a batch of images by splitting adocument image along every main scanning line (stretch in a horizontaldirection in FIG. 2) and in such a manner as to allow two or moreneighboring ones of the CCDs to obtain images by scanning the same areaof the scanner glass platen 201 and the document conveying surface 202.

For example, the CCD 1 scans an area L1 that stretches in a mainscanning direction and the CCD 2 scans an area L2 that stretches in amain scanning direction. An area L3 is an overlapping area between theareas L1 and L2, which corresponds to a right portion of the area L1 anda left portion of the area L2. That is, the CCDs 1 and 2 can obtainimages by scanning the same area of the scanner glass platen 201 and thedocument conveying surface 202. The same also holds true for allneighboring ones of the CCDs 2 to N.

The CCDs 1 to N each are comprised of RGB channels or RGB and Grchannels, which are arranged in a sub-scanning direction that is adirection in which a sheet of document is conveyed (also to be referredto as “a direction of FD”).

FIG. 3 is a block diagram illustrating an electrical configuration ofthe document scanner 20. The document scanner 20 is provided with: animage obtaining portion 1 consisting of the CCDs 1 to N; and thecontroller 100. The controller 100 detects a foreign body on the scannerglass platen 201 using images obtained by the image obtaining portion 1and performs image correction.

The controller 100 is provided with a CPU 2, a ROM 3, and a RAM 4. Thecontroller 100 is further provided with, as its functions, a degree ofmatching calculator 5, a source of noise identification portion 6, animage correcting portion 7, a composite image creator 8.

The CPU 2 controls the document scanner 20, including the imageobtaining portions 1 and the controller 100, in a unified and systematicmanner. ROM 3 is a memory for storing operation programs for the CPU 2and other data; the RAM 4 is a memory for providing a work area for theCPU 2 to execute processing in accordance with the operation programsstored on the ROM 3.

The image obtaining portion 1 allows the CCDs 1 to N to obtain a batchof images by splitting a document image along every main scanning line.The image obtaining portion 1 inputs the obtained images to thecontroller 100 and records the same on the RAM 4.

The degree of matching calculator 5 extracts a first image and a secondimage obtained by neighboring CCDs from the images received from theimage obtaining portion 1 and adjusts the size, in a main scanningdirection and a sub-scanning direction, of an overlapping area betweenthe first and second image. The overlapping area whose size is adjustedconstitutes a first area of the first image and a second area of thesecond image. The degree of matching calculator 5 shifts either one ofthe image of the first area and the image of the second area to theother one until these images are exactly superimposed one on the other;during that time, the degree of matching calculator 5 further calculatesthe degree of matching between the image of the first area and the imageof the second area.

With reference to the degree of matching obtained by the degree ofmatching calculator 5, the source of noise identification portion 6judges the image of a sheet of document on the document conveyingsurface 202 or a noise image due to a foreign body on the scanner glassplaten 201.

The image correcting portion 7 detects a clean image in either one ofthe first and second area, at a position corresponding to the positionof the noise image in the other one and performs image correction byreplacing the noise image with the clean image.

With reference to the degree of matching obtained by the degree ofmatching calculator 5, the composite image creator 8 creates a compositeimage based on the images of the first and second area. By repeatingthis operation, the composite image creator 8 can create one wholecomposite document image based on all the images obtained by the CCDs 1to N.

FIG. 4 is a main flowchart representing the entire operation to beperformed by the document scanner 20. The operation represented by theflowchart is performed by the CPU 2 of the document scanner 20 runningan operation program stored on a recording medium such as the ROM 3.

Upon input of images from the image obtaining portion 1 comprised of theCCDs 1 to N, the CPU 2 loads the images onto the RAM 4 (Step S1). TheCPU 2 extracts a first image and a second image obtained by neighboringCCDs (for example, the CCDs 1 and 2) therefrom and adjusts the size, ina main scanning direction and a sub-scanning direction, of anoverlapping area between the first and second image. The overlappingarea whose size is adjusted constitutes a first area of the first imageand a second area of the second image. The CPU 2 shifts at least eitherone of the image of the first area and the image of the second area tothe other one until these images are exactly superimposed one on theother; during that time, the CPU 2 further calculates the degree ofmatching between the image of the first area and the image of the secondarea (Step S2).

The CPU 2 can calculate the degree of matching using the followingmethods: calculating the logical sum or exclusive logical sum of binarypixel values; calculating the sum of squared differences in pixel value;and other methods. These methods will be later described in details.

With reference to the result of calculation, the CPU 2 identifies thesource of noise as either a sheet of document on the document conveyingsurface 202 or a foreign body on the scanner glass platen 201. In otherwords, the CPU 2 judges whether or not there is a foreign body on thescanner glass platen 201 (Step S3). Depending on the result of judgment,the CPU 2 detects a clean image in either one of the first and secondarea, at a position corresponding to the position of the noise image inthe other one. The CPU 2 then replaces the noise image with the cleanimage (Step S4).

The CPU 2 creates a composite image based on the first and second areaexactly superimposed one on the other (Step S5).

The above-described flowchart runs every time images are input by theCCDs 1 to N; one whole composite document image will be createdaccordingly.

FIG. 5 is a flowchart representing the operation of calculating thedegree of matching between images, which is Step S2 in the FIG. 4flowchart; FIGS. 6A and 6B are explanatory views on steps in the FIG. 5flowchart.

The CPU 2 extracts a first image and a second image obtained byneighboring CCDs from the images input by the multiple CCDs 1 to N (StepS21). The CPU 2 then adjusts the width Wo that is the size in a mainscanning direction of an area (overlapping area) between the first andsecond image obtained by the neighboring CCDs (Step S22). The CPU 2 mayadjust the width Wo depending on the architecture of the CCD opticalsystem. For example, the width Wo may be the amount of shrinkage in ahorizontal direction (a reduced width of the document conveying surface202) at the maximum. The amount of shrinkage is determined by an opticalpath to the CCDs and the maximum amount of paper clearance (the positionof the document conveying surface 202); the maximum amount of paperclearance is determined by the mechanical architecture.

The CPU 2 further adjusts the number of lines (height) Ho that is thesize in a sub-scanning direction of the overlapping area (Step S23). Thenumber of lines Ho is the height of the scanned images at the maximum;it may be the height of a certain area with appropriate pixel values formatching at the minimum. Since the presence of a white area is notpreferred for matching, the CPU 2 may adjust the number of lines Hodepending on the document type, picture or text; for example, it mayadjust the number of lines Ho to low when the white area is large andadjust it to high when the white area is small. Since a high number oflines Ho requires more memory space for processing, the CPU 2 may adjustthe number of lines Ho depending on the amount of memory space requiredfor processing. The number of lines Ho is the size in a documentconveying direction of the images obtained by the CCD 1 to N, at themaximum, which means that it must be equal to or lower than that size.

The overlapping area whose width Wo and height Ho are adjustedconstitutes a first area of the first image and a second area of thesecond image, and the CPU 2 shifts the image of the second area to theimage of the first area by a unit shift amount Ws. The CPU 2 repeatsthis shifting until these images are exactly superimposed one on theother (Step S24). The CPU 2 may shift the image of the first area to theimage of the second area instead of the second area to the first area.The CPU 2 may shift both images of the first and second area at the sametime. The unit shift amount Ws is one pixel in this embodiment, which ismost preferred in order to detect a foreign body on the scanner glassplaten 201 with a high degree of accuracy.

Every time the CPU 2 shifts the image of the second area to the image ofthe first area by the unit shift amount Ws, the CPU 2 calculates thedegree of matching between the image of the first are and the image ofthe second area, which is the degree of matching on (2Wo−Ws)×Ho andstores the result of calculation on the RAM 4, for example, along with acumulative shift amount WS that is the distance from the initialposition (Step S25).

Steps S24 and S25 will be repeated until the cumulative shift amount WSexceeds the width Wo (True in Step S26). If the cumulative shift amountWS exceeds the width Wo (False in Step S26), the CPU 2 terminates theoperation of calculating the degree of matching. The routine thenreturns to the FIG. 4 flowchart.

Steps S24 to S26 will be further described with reference to FIG. 6.FIG. 6A illustrates the first and second image obtained by neighboringCCDs, for example, the CCDs 1 and 2. There is an overlapping areabetween the first and second image, which is represented by a hatchedarea with the width Wo and the height Ho, and the overlapping areaconstitutes a first area of the first image and a second area of thesecond image. Code 400 indicates an image of the first area, and Code500 indicates an image of the second area.

FIG. 6B schematically illustrates the image 400 of the first area andthe image 500 of the second area. For illustrative purposes, the image400 of the first area and the image 500 of the second area both have 3pixels in width and 3 pixels in height. Each pixel has a luminance value(gray-scale); each pixel in the image 400 of the first area has the sameluminance value as that of its corresponding pixel in the image 500 ofthe second area. That is, the image 400 and image 500 exactly match eachother.

At least one of the image 400 and the image 500 is shifted to the otherone. For example, the image 500 of the second area is shifted to theimage 400 of the first area by one pixel that is the unit shift amount;when one column of pixels in the image 500 is exactly superimposed onone column of pixels in the image 400, the degree of matching betweenthe image 400 and the image 500 is calculated.

Similarly, the image 500 is further shifted to the image 400 by onepixel; when two columns of pixels in the image 500 are exactlysuperimposed on two columns of pixels in the image 400, the degree ofmatching between the image 400 and the image 500 is calculated. Theimage 500 in the second area is still further shifted to the image 400in the first area by one pixel; when three columns of pixels in theimage 500 are exactly superimposed on three columns of pixels in theimage 400, the degree of matching between the image 400 and the image500 is calculated. In this embodiment, when all the three columns ofpixels are exactly superimposed on all the three columns of pixels, anexact match between the image 400 of the first area and the image 500 ofthe second area can be proved. If the cumulative shift amount WS exceedsthe width Wo, the operation of calculating the degree of matching isterminated.

FIGS. 7A to 7E are explanatory views on Steps S24 to S26 in the FIG. 5flowchart when there is a foreign body such as lint or dust on thescanner glass platen 201.

FIG. 7A illustrates a sample image 300 on a sheet of document, which isa base of the image 400 of the first area and the image 500 of thesecond area. FIG. 7B illustrates the image 400 of the first area and theimage 500 of the second area when there is a foreign body on the scannerglass platen 201. The foreign body on the scanner glass platen 201causes a linear noise image 401 in the image 400 of the first area and alinear noise image 501 in the image 500 of the second area; the noiseimages 401 and 501 are found at different positions in a main scanningdirection. That is because the scanner glass platen 201 and the documentconveying surface 202, which is also a scanning surface, are disposed atdifferent positions and thus have different focal depths.

At least one of the image 400 of the first area and the image 500 of thesecond area is shifted to the other one, pixel by pixel, as illustratedin FIG. 7C. The lower drawing of FIG. 7D illustrates the noise image 401in the image 400 of the first area and the noise image 501 in the image500 of the second area exactly superimposed one on the other; as isunderstood therefrom, the image 400 of the first area and the image 500of the second area are not exactly superimposed one on the other. Theupper drawing of FIG. 7D illustrates the image 400 of the first area andthe image 500 of the second area exactly superimposed one on the other;as is understood therefrom, the noise image 401 and 501 are not exactlysuperimposed one on the other and these are found at differentpositions.

FIG. 7E is a histogram showing the changes in the degree of matchingbetween the image 400 of the first area and the image 500 of the secondarea with respect to a cumulative shift amount WS, which is createdusing the data stored on a recording medium.

As is understood from the histogram, the degree of matching reaches itspeak at two minimum points P1 and P2 when the image 500 of the secondarea is shifted. The image 400 of first area and the image 500 of thesecond area are exactly superimposed one on the other at the minimumpoint P1, and the noise image 401 in the image 400 and the noise image501 in the image 500 are exactly superimposed one on the other at theminimum point P2. In other words, the presence of the two minimum pointsP1 and P2 proves that these images have different focal depths (thescanner glass platen 201 and the document conveying surface 202 havedifferent focal depths, in this embodiment).

The degree of matching between the image 400 of the first area and theimage 500 of the second area is calculated to be used as an indicator,with which the source of noise is identified as either a sheet ofdocument on the scanner glass platen 201 or a foreign body on thedocument conveying surface 202. Specifically, it can be calculated usingthe following methods.

(1) Logical sum or exclusive logical sum of binary pixel values: thesecan be described as the following formulas.

$\begin{matrix}{{R_{sum} = {{\sum\limits_{j = 0}^{N - 1}\;{\sum\limits_{i = 0}^{M - 1}{I\left( {i,j} \right)}}}\bigcup{T\left( {i,j} \right)}}}{R_{xor} = {{\sum\limits_{j = 0}^{N - 1}\;{\sum\limits_{i = 0}^{M - 1}{I\left( {i,j} \right)}}}\bigcup\limits_{\_}{T\left( {i,j} \right)}}}} & \left\lbrack {{Formula}\mspace{14mu} 1} \right\rbrack\end{matrix}$

(2) Sum of squared differences in pixel value: this can be described asthe following formula.

$\begin{matrix}{R_{SSD} = {\sum\limits_{j = 0}^{N - 1}\;{\sum\limits_{i = 0}^{M - 1}\left( {{I\left( {i,j} \right)} - {T\left( {i,j} \right)}} \right)^{2}}}} & \left\lbrack {{Formula}\mspace{14mu} 2} \right\rbrack\end{matrix}$

(3) Sum of absolute differences in pixel value: this can be described asthe following formula.

$\begin{matrix}{R_{SAD} = {\sum\limits_{j = 0}^{N - 1}\;{\sum\limits_{i = 0}^{M - 1}{{{I\left( {i,j} \right)} - {T\left( {i,j} \right)}}}}}} & \left\lbrack {{Formula}\mspace{14mu} 3} \right\rbrack\end{matrix}$

(4) Normalized cross-correlation: this can be described as the followingformula.

$\begin{matrix}{R_{NCC} = \frac{\sum\limits_{j = 0}^{N - 1}\;{\sum\limits_{i = 0}^{M - 1}{{I\left( {i,j} \right)}{T\left( {i,j} \right)}}}}{\sqrt{\sum\limits_{j = 0}^{N - 1}\;{\sum\limits_{i = 0}^{M - 1}{{I\left( {i,j} \right)}^{2} \times {\sum\limits_{j = 0}^{N - 1}\;{\sum\limits_{i = 0}^{M - 1}{T\left( {i,j} \right)}^{2}}}}}}}} & \left\lbrack {{Formula}\mspace{14mu} 4} \right\rbrack\end{matrix}$

(5) Zero-mean normalized cross-correlation for eliminating theinteractions of luminance as quickly as possible: this can be describedas the following formula.

$\begin{matrix}{R_{ZNCC} = \frac{\sum\limits_{j = 0}^{N - 1}\;{\sum\limits_{i = 0}^{M - 1}{\left( {{I\left( {i,j} \right)} - \overset{\_}{I}} \right)\left( {{T\left( {i,j} \right)} - \overset{\_}{T}} \right)}}}{\sqrt{\sum\limits_{j = 0}^{N - 1}\;{\sum\limits_{i = 0}^{M - 1}{\left( {{I\left( {i,j} \right)} - \overset{\_}{I}} \right)^{2} \times {\sum\limits_{j = 0}^{N - 1}\;{\sum\limits_{i = 0}^{M - 1}\left( {{T\left( {i,j} \right)} - \overset{\_}{T}} \right)^{2}}}}}}}} & \left\lbrack {{Formula}\mspace{14mu} 5} \right\rbrack\end{matrix}$

In all the formulas above, I(i, j) represents a pixel value in theoverlapping area of the first image and T(i, j) represents a pixel valuein the overlapping area of the second image.

FIG. 8 is a flowchart representing the operation of identifying thesource of noise, which is Step S3 in the FIG. 4 flowchart; FIGS. 9A to9D are explanatory views on steps in the FIG. 8 flowchart.

The CPU 2 judges whether or not the degree of matching reaches its peakat more than one point (more than one minimum point) with reference tothe histogram showing the changes in the degree of matching with respectto a shift amount (Step S31). As illustrated in FIG. 9A, the image 400of the first area and the image 500 of the second area are exactlysuperimposed one on the other at one minimum point, and the noise images401 and 501, which are caused by a foreign body on the scanner glassplaten 201, are exactly superimposed one on the other at another minimumpoint.

If the degree of matching does not reach its peak at more than one point(False in Step S31), the routine terminates. If the degree of matchingreaches its peak at more than one point (True in Step S31), the CPU 2detects a first minimum point from the histogram showing the changes inthe degree of matching (Step S32) and further detects a second minimumpoint from the same (Step S33). When there are three or more minimumpoints, the CPU 2 will detect them all. There are two minimum points inthis example.

The image 400 of the first area and the image 500 of the second area atthe two minimum points can be visualized as a first and secondsuperimposed image. The CPU 2 judges whether or not a superimposedcontinuous image with uniform pixel values, which stretch in a directionof FD, (i.e. the noise areas exactly one on the other) is found ineither one of the two superimposed images (Step S34).

As is understood from FIG. 9A, the image 400 of the first area and theimage 500 of the second area at the minimum point P2 can be visualizedas a second superimposed image, in which the noise images 401 and 501are exactly superimposed one on the other; one image with uniform pixelvalues, which stretches in a direction of FD, can be identified as noiseaccordingly. The image 400 of first area and the image 500 of the secondarea at the minimum point P1 can be visualized as a first superimposedimage, in which the image 400 of the first area and the image 500 of thesecond area are exactly superimposed one on the other but the noiseimages 401 and 501 do not; the noise images 401 and 501 can be found atdifferent positions in a main scanning direction accordingly.

In Step S34, the CPU 2 judges whether or not the superimposed continuousimage with uniform pixel values, which stretch in a direction of FD andare exactly superimposed one on the other, are found in either one ofthe first and second superimposed image. If such part are found ineither one of them (True in Step S34), the CPU 2 judges that it is noise(detects a foreign body on the scanner glass platen 201) (Step S35) andterminates this operation. The routine then returns to the FIG. 4flowchart.

By the way, a sheet of document may contain a linear image stretching ina direction of FD. Such a linear image causes an image with uniformpixel values in the image 400 of the first area and the image 500 of thesecond area and can be hardly distinguished from the noise images 401and 501 caused by a foreign body on the scanner glass platen 201, asillustrated in FIG. 9B. Since the superimposed continuous image withuniform pixel values, which stretch in a direction of FD and exactlysuperimposed one on the other, is found in both of the first and secondsuperimposed image, the CPU 2 results in False in Step S34.

In this embodiment, the CPU 2 performs Step S36 and the following stepsto distinguish between them. This operation will be described withreference to FIGS. 9C and 9D. While RGB channels are arranged in asub-scanning direction that is a direction of FD, a foreign body such aslint on the scanner glass platen 201 is rarely large enough to hide allthe three channels. In many cases, the size of a foreign body is roughlycomparable to the size of one or two channels.

FIG. 9C illustrates a foreign body hiding only one channel (for example,an R channel). In this case, the RGB luminance value is (0, 255, 255)when 256-level RGB luminance is enabled. Furthermore, the result of theexpression Max(RGB)−Min(RGB), which means the difference between themaximum and minimum luminance values among these three channels, isequal to 255, which is a maximum value. The same holds true for aforeign body hiding two channels.

FIG. 9D illustrates a linear image of a sheet of document hiding all theRGB channels. In this case, the RGB luminance value is (0, 0, 0) and theresult of the expression Max(RGB)−Min(RGB) is equal to 0, which is aminimum value. By comparing the result of the expressionMax(RGB)−Min(RGB) between the first and second superimposed image, itcan be judged whether or not it is a noise area.

Back to Step S36 in FIG. 8, about the first superimposed image, the CPU2 calculates the difference between the maximum and minimum luminancevalues among the FD line channels (the RGB channels) using theexpression Max(RGB)−Min(RGB). Similarly, in Step S37, about the secondsuperimposed image, the CPU 2 calculates the difference between themaximum and minimum luminance values among the FD line channels usingthe expression Max(RGB)−Min(RGB).

In Step S38, each result of the expression Max(RGB)−Min(RGB) is comparedto its threshold value set in advance as described below. When theresult of the expression Max(RGB)−Min(RGB) at the first minimumpoint>threshold value and the result of expression Max(RGB)−Min(RGB) atthe second minimum point<threshold value, the CPU 2 judges that thefirst superimposed image is affected by noise in Step S39. When theresult of the expression Max(RGB)−Min(RGB) at the second minimumpoint>threshold value and the result of the expression Max(RGB)−Min(RGB)at the first minimum point<threshold value, the CPU 2 judges that thesecond superimposed image is affected by noise in Step S40. The routinethen returns to the FIG. 4 flowchart.

FIG. 10 is a flowchart representing the operation of replacing a noiseimage with a clean image, which is Step S4 in the FIG. 4 flowchart.FIGS. 11A and 11B are explanatory views on steps in the FIG. 10flowchart. This is the operation of removing a noise image caused by aforeign body on the scanner glass platen 201 and putting a clean imageas a replacement.

The right-hand part of FIG. 11A shows a histogram showing the changes inthe degree of matching calculated by the degree of matching calculator5; there are the minimum points P1 and P2 in this histogram. Withreference to the histogram, the CPU 2 calculates the distance Lppbetween tow noise images in the first superimposed image (the shiftamount between the two minimum points) (Step S41 in FIG. 10). Thedistance Lpp is equal to the distance between the noise area 401 in theimage 400 of the first area and the noise area 501 in the image 500 ofthe second area when the images 400 and 500 are exactly superimposed oneon the other, as is illustrated in FIG. 11A.

The CPU 2 detects a clean image in the image 500 of the second area, ata position corresponding to the position of the noise image 401 in theimage 400 of the first area and replaces the noise image 401 with theclean imsge (Step S42 in FIG. 10). Similarly, the CPU 2 detects a cleanimage in the image 400 of the first area 400, at a positioncorresponding to the position of the noise image 501 in the image 500 ofthe second area and replaces the noise image 501 with the clean image(Step S43 in FIG. 10). That is, the CPU 2 detects a clean image ineither one of the image 400 of the first area and the image 500 of thesecond area, at a position corresponding to the position of the noiseimage in the other one. The CPU 2 then replaces the noise image with theclean image.

This replacement operation will be further described in details withreference to FIG. 11B. There is a clean image 502 in the image 500 ofthe second area, at a position corresponding to the position of thenoise image 401 in the image 400 of the first area. The clean image 502is at a distance Lpp from the noise image 501 in the image 500. Thenoise image 401 of the image 400 of the first image can be thus replacedwith the clean image 502 in the image 500 of the second area. Similarly,there is a clean image 402 in the image 400 of the first area, at aposition corresponding to the position of the noise image 501 in theimage 500 of the second area. The clean image 402 is at a distance Lppfrom the noise image 401 in the image 400 of the first area. The noiseimage 501 in the image 500 of the second image can be thus replaced withthe clean image 402 in the image 400 of the first area. In this mannerdescribed above, the image 400 of the first area and the image 500 ofthe second area are cleaned up.

FIG. 12 is a flowchart representing the operation of creating acomposite image, which is Step S5 in the FIG. 4 flowchart; FIG. 13 is anexplanatory view on the operation of image composition. This is theoperation of creating a composite image based on the image 400 of thefirst area and the image 500 of the second area, which are obtained byneighboring ones of the CCDs 1 to N, one on the other.

The CPU 2 calculates an average pixel value of the image 400 of thefirst area excluding the noise image 401 and an average pixel value ofthe image 500 of the second area excluding the noise image 501 (StepS51). For example, the left-hand part of FIG. 13A shows the image 400 ofthe first area excluding the noise image 401 and the right-hand part ofFIG. 13A shows the image 500 of the second area excluding the noiseimage 501; average pixel values of these images are calculated.

Using these average pixel values, the CPU 2 creates a composite image600 as illustrated in FIG. 13A (Step S52). After the creation of acomposite image, the routine returns to the FIG. 4 flowchart.

The CCDs 1 to N can hardly read both ends of their target scanning areaswith a high degree of accuracy. As illustrated in FIG. 13A, a CCD closerto the left end can read a left part of the images 400 and 500 with ahigh degree of accuracy and a CCD closer to the right end can read aright part of the images 400 and 500 with a high degree of accuracy. Tosolve this problem, this embodiment can be configured as illustrated inFIG. 13B: a left half of the image 400 of the first area and a righthalf of the image 500 of the second area, respectively, are extractedfrom the images 400 and 500 and the composite image 600 is created bycombining the left half of the image 400 of the first area and the righthalf of the image 500 of the second area together.

While one embodiment of the present invention has been described indetails herein it should be understood that the present invention is notlimited to the foregoing embodiment. For example, in this embodiment, aforeign body such as lint or dust on the scanner glass platen 201 isdetected using scanned images and image correction is performed byreplacing a noise image is replaced with a clean image. This embodimentmay be configured as the following: a foreign body such as lint or duston the scanner glass platen 201 is detected and image correction is notperformed but a message requesting to clean up the scanner glass platen201 is displayed instead.

While the present invention may be embodied in many different forms, anumber of illustrative embodiments are described herein with theunderstanding that the present disclosure is to be considered asproviding examples of the principles of the invention and such examplesare not intended to limit the invention to preferred embodimentsdescribed herein and/or illustrated herein.

While illustrative embodiments of the invention have been describedherein, the present invention is not limited to the various preferredembodiments described herein, but includes any and all embodimentshaving equivalent elements, modifications, omissions, combinations (e.g.of aspects across various embodiments), adaptations and/or alterationsas would be appreciated by those in the art based on the presentdisclosure. The limitations in the claims are to be interpreted broadlybased on the language employed in the claims and not limited to examplesdescribed in the present specification or during the prosecution of theapplication, which examples are to be construed as non-exclusive. Forexample, in the present disclosure, the term “preferably” isnon-exclusive and means “preferably, but not limited to”. In thisdisclosure and during the prosecution of this application,means-plus-function or step-plus-function limitations will only beemployed where for a specific claim limitation all of the followingconditions are present In that limitation: a) “means for” or “step for”is expressly recited; b) a corresponding function is expressly recited;and c) structure, material or acts that support that structure are notrecited. In this disclosure and during the prosecution of thisapplication, the terminology “present invention” or “invention” may beused as a reference to one or more aspect within the present disclosure.The language present invention or invention should not be improperlyinterpreted as an identification of criticality, should not beimproperly interpreted as applying across all aspects or embodiments(i.e., it should be understood that the present invention has a numberof aspects and embodiments), and should not be improperly interpreted aslimiting the scope of the application or claims. In this disclosure andduring the prosecution of this application, the terminology “embodiment”can be used to describe any aspect, feature, process or step, anycombination thereof, and/or any portion thereof, etc. In some examples,various embodiments may include overlapping features. In this disclosureand during the prosecution of this case, the following abbreviatedterminology may be employed: “e.g.” which means “for example”, and “NB”which means “note well”.

What is claimed is:
 1. An image reading device comprising: a scannerglass; and a plurality of CCD photo-sensors arranged at intervals in amain scanning direction, the CCD photo-sensors reading an image on asheet of document conveyed in a sub-scanning direction on a documentconveying surface, the document conveying surface disposed above thescanner glass, wherein the CCD photo-sensors are arranged to allow twoor more neighboring CCD photo-sensors to obtain a first image and asecond image by scanning the same area of the surface of the scannerglass and the document conveying surface, the image reading devicefurther comprising: a size adjuster adjusting the size, in a mainscanning direction and a sub-scanning direction, of an overlapping areabetween the first and second image obtained by the neighboring CCDphoto-sensors, the overlapping area constituting a first area of thefirst image and a second area of the second image; a superimposingportion superimposing either one of an image of the first area and animage of the second area on the other one by shifting at least one ofthe image of the first area and the image of the second area to theother one, the first and second area having the size adjusted by thesize adjuster; a degree-of-matching calculator calculating the degree ofmatching between the image of the first area and the image of the secondarea while the superimposing portion is shifting at least one of theimage of the first area and the image of the second area to the otherone; a judgment portion judging whether or not the images havingdifferent focal depths exist based on the degree of matching calculatedby the degree-of-matching calculator; and a foreign body detectordetecting a foreign body on the surface of the scanner glass bydetecting a continuous image stretching in a document conveyingdirection in both of the images having different focal depths, if thejudgment portion judges that the images having different focal depthsexist.
 2. The image reading device according to claim 1, wherein: thesize in a main scanning direction being adjusted by the size adjuster isa reduced width of the overlapping area on the sheet of the document onthe document conveying surface at the maximum, the reduced width of theoverlapping area being determined by an optical path to the CCDphoto-sensors and the position of the document conveying surface, theposition being determined by a mechanical architecture of the imagereading device; and the size in a sub-scanning direction being adjustedby the size adjuster is the size in a document conveying direction ofthe images obtained by the CCD photo-sensors, at the maximum.
 3. Theimage reading device according to claim 1, wherein the superimposingportion further repeats the operation of shifting at least one of theimage of the first area and the image of the second area to the otherone by one unit of pixels until a shift amount reaches the size in amain scanning direction being adjusted by the size adjuster.
 4. Theimage reading device according to claim 1, wherein: thedegree-of-matching calculator calculates the degree of matching usingany of the following methods: logical sum of binary pixel values;exclusive logical sum of binary pixel values; sum of squared differencesin pixel value; sum of absolute differences in pixel value; andnormalized cross-correlation; and the degree-of-matching calculatorfurther creates and records a histogram, the histogram showing changesin the degree of matching with respect to a shift amount by which thesuperimposing portion shifts at least one of the image of the first areaand the image of the second area to the other one.
 5. The image readingdevice according to claim 4, wherein the judgment portion further judgesthat the images having different focal depths exist by detecting twopoints in the histogram created by the degree-of-matching calculator,the two points showing the two highest degrees of matching.
 6. The imagereading device according to claim 5, wherein: the foreign body detectorfurther checks whether or not a superimposed continuous image stretchingin the document conveying direction exists in either a firstsuperimposed image or a second superimposed image, the superimposedcontinuous image is obtained by superimposing either one of thecontinuous image in the first area and the continuous image in thesecond area on the other one, the first superimposed image and thesecond superimposed image are obtained by superimposing either one ofthe image of the first area and the image of the second area on theother one at the two points, the two points showing the two highestdegrees of matching; if the superimposed continuous image stretching inthe document conveying direction exists in either the first superimposedimage or the second superimposed image, the foreign body detectoridentifies the superimposed continuous image stretching in the documentconveying direction as noise image caused by a foreign body on thesurface of the scanner glass.
 7. The image reading device according toclaim 6, wherein: if the superimposed continuous image stretching in thedocument conveying direction exists in both the first superimposed imageand the second superimposed image; the foreign body detector identifiesas noise image the superimposed continuous image in the first or secondsuperimposed image that has the difference between the maximum andminimum pixel values in the superimposed continuous image, which isequal to or greater than a threshold value, the pixel values obtained bymultiple channels of the CCD photo-sensors.
 8. The image reading deviceaccording to claim 1, further comprising a distance calculatorcalculating the distance between two points in a histogram created fromthe calculation results obtained by the degree-of-matching calculator,the two points showing the two highest degrees of matching, wherein theimages of the first and second area are exactly superimposed one on theother at one of the two points and the noise images of the first andsecond area are exactly superimposed one on the other at the other oneof the two points, the image reading device further comprising: a cleanimage detector detecting a clean image in either one of the first andsecond area, at a position corresponding to the position of the noiseimage in the other one, with reference to the distance calculated by thedistance calculator; a replacement portion replacing the noise imagewith the clean image detected by the clean image detector; and acomposite image creator creating a composite image based on the imagesof the first and second area exactly superimposed one on the other. 9.The image reading device according to claim 8, wherein the compositeimage creator creates a composite image using an average pixel value ofthe image of the first area excluding the noise area and an averagepixel value of the image of the second area excluding the noise area.10. The image reading device according to claim 8, wherein the compositeimage creator creates a composite image by combining a left half widthof either one of the images of the first and second area and a righthalf width of the other one together.
 11. A method for an image readingdevice to detect a foreign body on the surface of a scanner glass, theimage reading device comprising: the scanner glass; and a plurality ofCCD photo-sensors being arranged at intervals in a main scanningdirection, the CCD photo-sensors reading an image on a sheet of documentconveyed in a sub-scanning direction on a document conveying surface,the document conveying surface being disposed above the scanner glass,wherein the CCD photo-sensors are arranged to allow two or moreneighboring ones of the CCD photo-sensors to obtain a first image and asecond image by scanning the same area of the surface of the scannerglass and the document conveying surface, the method comprising thefollowing steps of the image reading device: adjusting the size, in amain scanning direction and a sub-scanning direction, of an overlappingarea between the first and second image obtained by the neighboring CCDphoto-sensors, the overlapping area constituting a first area of thefirst image and a second area of the second image; superimposing eitherone of an image of the first area and an image of the second area on theother one by shifting at least one of the image of the first area andthe image of the second area to the other one, the first and second areahaving the size being adjusted; calculating the degree of matchingbetween the image of the first area and the image of the second areawhile at least one of the image of the first area and the image of thesecond area is being shifted to the other one; judging whether or notthe images having different focal depths exist with reference to thedegree of matching being calculated; and detecting a foreign body on thesurface of the scanner glass by detecting a continuous image stretchingin a document conveying direction in both of the images having differentfocal depths, if it is judged that the images having different focaldepths exist.
 12. A non-transitory computer-readable recording mediumstoring a program to be run by an image reading device to detect aforeign body on the surface of a scanner glass, the image reading devicecomprising: the scanner glass; and a plurality of CCD photo-sensorsbeing arranged at intervals in a main scanning direction, the CCDphoto-sensors reading an image on a sheet of document conveyed in asub-scanning direction on a document conveying surface, the documentconveying surface being disposed above the scanner glass, wherein theCCD photo-sensors are arranged to allow two or more neighboring ones ofthe CCD photo-sensors to obtain a first image and a second image byscanning the same area of the surface of the scanner glass and thedocument conveying surface, the program making a computer of the imagereading device execute the following steps: adjusting the size, in amain scanning direction and a sub-scanning direction, of an overlappingarea between the first and second image obtained by the neighboring CCDphoto-sensors, the overlapping area constituting a first area of thefirst image and a second area of the second image; superimposing eitherone of an image of the first area and an image of the second area on theother one by shifting at least one of the image of the first area andthe image of the second area to the other one, the first and second areahaving the size being adjusted; calculating the degree of matchingbetween the image of the first area and the image of the second areawhile at least one of the image of the first area and the image of thesecond area is being shifted to the other one; judging whether or notthe images having different focal depths exist with reference to thedegree of matching being calculated; and detecting a foreign body on thesurface of the scanner glass by detecting a continuous image stretchingin a document conveying direction in both of the images having differentfocal depths, if it is judged that the images having different focaldepths exist.
 13. The non-transitory computer-readable recording mediumaccording to claim 12, wherein: the size in a main scanning directionbeing adjusted by the size adjuster is a reduced width of theoverlapping area on the sheet of the document on the document conveyingsurface at the maximum, the reduced width of the overlapping area beingdetermined by an optical path to the CCD photo-sensors and the positionof the document conveying surface, the position being determined by amechanical architecture of the image reading device; and the size in asub-scanning direction being adjusted by the size adjuster is the sizein a document conveying direction of the images obtained by the CCDphoto-sensors, at the maximum.
 14. The non-transitory computer-readablerecording medium according to claim 12, wherein the operation ofshifting at least one of the image of the first area and the image ofthe second area to the other one by one unit of pixels is repeated untila shift amount reaches the size in a main scanning direction beingadjusted.
 15. The non-transitory computer-readable recording mediumaccording to claim 12, wherein: the degree of matching is calculatedusing any of the following methods: logical sum of binary pixel values;exclusive logical sum of binary pixel values; sum of squared differencesin pixel value; sum of absolute differences in pixel value; andnormalized cross-correlation; and a histogram is created and recorded,the histogram showing changes in the degree of matching with respect toa shift amount by which at least one of the first and second area isshifted to the other one.
 16. The non-transitory computer-readablerecording medium according to claim 15, wherein it is judged that theimages having different focal depths exist by detecting two points inthe histogram being created, the two points showing the two highestdegrees of matching.
 17. The non-transitory computer-readable recordingmedium according to claim 16, wherein: it is checked whether or not asuperimposed continuous image stretching in the document conveyingdirection exists in either a first superimposed image or a secondsuperimposed image, the superimposed continuous image is obtained bysuperimposing either one of the continuous image in the first area andthe continuous image in the second area on the other one, the firstsuperimposed image and the second superimposed image are obtained bysuperimposing either one of the image of the first area and the image ofthe second area on the other one at the two points, the two pointsshowing the two highest degrees of matching; if the superimposedcontinuous image stretching in the document conveying direction existsin either the first superimposed image or the second superimposed image,the superimposed continuous image stretching in the document conveyingdirection is identified as noise image caused by a foreign body on thesurface of the scanner glass.
 18. The non-transitory computer-readablerecording medium according to claim 17, wherein if the superimposedcontinuous image stretching in the document conveying direction existsin both the first superimposed image and the second superimposed image;the superimposed continuous image in the first or second superimposedimage that has the difference between the maximum and minimum pixelvalues in the superimposed continuous image, which is equal to orgreater than a threshold value, is identified as noise image, the pixelvalues obtained by multiple channels of the CCD photo-sensors.
 19. Thenon-transitory computer-readable recording medium according to claim 12,storing the program to be run by the computer, the program making thecomputer further execute calculating the distance between two points ina histogram created from the calculation results, the two points showingthe highest degrees of matching, wherein the images of the first andsecond area are exactly superimposed one on the other at one of the twopoints and the noise images of the first and second area are exactlysuperimposed one on the other at the other one of the two points, theprogram making the computer further execute: detecting a clean image ineither one of the first and second area, at a position corresponding tothe position of the noise image in the other one, with reference to thedistance being calculated; replacing the noise image with the cleanimage being detected; and creating a composite image based on the imagesof the first and second area exactly superimposed one on the other. 20.The non-transitory computer-readable recording medium according to claim19, wherein a composite image is created using an average pixel value ofthe image of the first area excluding the noise area and an averagepixel value of the image of the second area excluding the noise area.21. The non-transitory computer-readable recording medium according toclaim 19, wherein a composite image is created by combining a left halfwidth of either one of the images of the first and second area and aright half width of the other one together.